﻿using B.S.Data.MES.API.Applications.ProcessmaintenanceApplications.Command;
using B.S.Data.MES.API.Dto.DTOProcess;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Data.MES.API.Controllers; using AutoMapper;
using B.S.Data.MES.API.Applications.ProcessmaintenanceApplications.Command;
using B.S.Data.MES.API.Dto.DTOProcess;
using B.S.Domain.Process.ProcessmaintenanceModel;
using B.S.Infratrctrue;
using B.S.Requst;
using MediatR;

/// <summary>
/// 工艺维护控制器
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class ProcessmaintenanceController : ControllerBase
{
    IMediator mediator;

    public ProcessmaintenanceController(IMediator mediator)
    {
        this.mediator = mediator;
    }
    /// <summary>
    /// 工艺维护列表显示
    /// </summary>
    /// <param name="request"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<APIPageing<List<DtoProcessmaintenance>>> ShowProcessmaintenance([FromQuery]ShowProcessmaintenanceCommand request)
    {
        return await mediator.Send(request);
    }
    /// <summary>
    /// 工艺维护列表添加
    /// </summary>
    /// <param name="request"></param>
    /// <returns></returns>
    [HttpPost]
    public async Task<APIRequst<int>> AddProcessmaintenance([FromBody]AddProcessmaintenanceCommand request)
    {
        return await mediator.Send(request);
    }
    /// <summary>
    /// 工艺维护列表删除
    /// </summary>
    /// <param name="request"></param>
    /// <returns></returns>
    [HttpPost]
    public async Task<APIRequst<int>> DeleteProcessmaintenance([FromBody]DeleteProcessmaintenanceCommand request)
    {
        return await mediator.Send(request);
    }
    /// <summary>
    /// 工艺维护列表修改
    /// </summary>
    /// <param name="request"></param>
    /// <returns></returns>
    [HttpPost]
    public async Task<APIRequst<int>> UpdateProcessmaintenance([FromBody]UpdateProcessmaintenanceCommand request)
    {
        return await mediator.Send(request);
    }
}
